/*******************************************OVERVIEW*******************************************************
 
 Political Shocks and Asset Prices
 
 Replication do file
 
 Code to Estimate Volatility Ratios
 
 Version July 9 2021 
 
  
********************************************************************************************************************/


clear
set more off
#delimit ;


/*Set Directory -- You will need to adjust this line of code accordingly */; 


cd "/Users/ssaiegh/Files/Mac/UCSD/Carnahan/Shocks/Replication Files";

/*Create Log File*/;

log using "Volatiliy Ratios", replace text;

/*Load Data File*/;

use "daily_sp_argentina_2020.dta";

/*Estimate Volatility Ratios*/;

gen case_id= _n;

tsset case_id;

gen event=(steward==1 | gov_change==1 | dem_change==1 | elec==1 | terror==1);

gen ret_nom=log(nominal/L.nominal);
arch ret_nom ret_sp, arch(1) garch(1) vce(robust);
predict var_nom, var;
predict res_nom, res;
gen risk_nom=sqrt(var_nom);
gen stan_nom=res_nom/risk_nom;
gen abs_nom=abs(stan_nom);

gen ratio_nom=log(F.var_nom/var_nom);

gen ret_inf=log(inflation/L.inflation);
arch ret_inf ret_sp_real, arch(1) garch(1) atarch(1) vce(robust);
predict var_inf, var;
predict res_inf, res;
gen risk_inf=sqrt(var_inf);
gen stan_inf=res_inf/risk_inf;
gen abs_inf=abs(stan_inf);

gen ratio_inf=log(F.var_inf/var_inf);

gen ret_dol=log(dollar/L.dollar);
arch ret_dol ret_sp_real, arch(1) garch(1) vce(robust);
predict var_dol, var;
predict res_dol, res;
gen risk_dol=sqrt(var_dol);
gen stan_dol=res_dol/risk_dol;
gen abs_dol=abs(stan_dol);

gen ratio_dol=log(F.var_dol/var_dol);


log c;
